﻿@model VendorModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
    Html.AddTitleParts(Model.Name);

    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var vendorUrl = Url.RouteUrl("Vendor", new { SeName = Model.SeName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(vendorUrl);
    }
}
@using Nop.Core.Domain.Seo;
@using Nop.Core.Infrastructure;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="page vendor-page">
    <div class="panel panel-default form-panel">
        <div class="panel-heading">
            <h3>@Model.Name</h3>
        </div>
        <div class="panel-body">
            @Html.Widget("vendordetails_top")
            @*description*@
            @if (!String.IsNullOrWhiteSpace(Model.Description))
            {
                <div class="vendor-description alert alert-info square-box">
                    @Html.Raw(Model.Description)
                </div>
            }
        
            <div class="row">
                <div class="col-md-12">
                    <div class="product-selectors clearfix">
                        @*view mode*@
                        @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
                        {
                            <div class="col-md-4 pull-text-center">
                                <div class="row">
                                    <div class="col-md-4 remove_right_padding">
                                        <span>@T("Vendors.ViewMode")</span>
                                    </div>
                                    <div class="col-md-5 remove_left_padding">
                                        @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                    </div>
                                </div>
                            </div>
                        }
                        @*sorting*@
                        @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
                        {
                            <div class="col-md-4 pull-text-center">
                                <div class="row">
                                    <div class="col-md-4 remove_right_padding">
                                        <span>@T("Vendors.OrderBy")</span>
                                    </div>
                                    <div class="col-md-8 remove_left_padding">
                                        @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                    </div>
                                </div>                  
                            </div>
                        }
                        @*page size*@
                        @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
                        {
                            <div class="col-md-4 pull-text-center">
                                <div class="row">
                                    <div class="col-md-offset-2 col-md-3">
                                        <span>@T("Vendors.PageSize")</span> 
                                    </div>
                                    <div class="col-md-3 remove_left_padding remove_right_padding">
                                        @Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                    </div>
                                    <div class="col-md-4 remove_left_padding">
                                        <span>@T("Vendors.PageSize.PerPage")</span>
                                    </div>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
            @*product list*@
            @if (Model.Products.Count > 0)
            {
                if (Model.PagingFilteringContext.ViewMode == "list")
                {
            @*list mode*@
                    <div class="product-list">
                        @foreach (var product in Model.Products)
                        {
                            <div class="offer offer-default">
                                @Html.Partial("_ProductBox", product)
                            </div>
                        }
                    </div>
                }
                else
                {
            @*grid mode*@


                    <div class="product-grid home-page-product-grid">
                        @{
                            var pg_i = 0;
                        }
                        @foreach (var product in Model.Products)
                        {
                            if(pg_i%3==0)
                            {
                                @:<div class="row box-products">
                            }
                        
                            <div class="col-md-4">
                                <div class="offer offer-default silde-show-offer pull-text-center">
                                    @Html.Partial("_ProductBox", product)
                                </div>
                            </div>
                            if(pg_i%3==2)
                            {
                                @:</div>
                            }

                            pg_i++;
                        }
                        @if(pg_i%3!=0)
                        {
                            @:</div>
                        }

                    </div>


                }
            }
            <div class="pager">
                @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
            </div>
            @Html.Widget("vendordetails_bottom")
        </div>
    </div>
</div>

